<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<title>选择会员</title>
	<meta content="width=device-width,initial-scale=1.0,minimum-scale=1.0.maximum-scale=1.0,user-scalable=no"
		name="viewport">
	<link rel="stylesheet" href="css/reset.css">
	<link rel="stylesheet" href="css/bosscoach.css">
	<link rel="stylesheet" href="css/membership.css">
	<link rel="stylesheet" href="css/reset.css">
	<link rel="stylesheet" href="css/bossIndex.css">
	<link rel="stylesheet" href="css/flexible.css">
	<link rel="stylesheet" href="css/vant.css">
	<script src="js/vue/vue.js"></script>
	<script src="js/vue/axios.js"></script>
	<script src="js/vue/vant.js"></script>
	<script src="js/vue/MD5.js"></script>
	<script src="js/vue/qs.js"></script>
	<script src="js/glabe.js"></script>
	<script src="js/fontsize.js"></script>
</head>

<body>
	<div class="container_box" id="app" style="padding-top:0rem;">
		<header>
			<div class="search bar3" style="width:100%;">
				<form @submit.prevent action="#">
					<input @keyup.enter.native="search" v-model="from.phone" type="search" placeholder="搜索会员姓名/手机号码">
					<button @click="search" type="text"><img src="images/search.png"></button>
				</form>
			</div>
		</header>
		<template>
			<div style="margin-top: .1rem;" class="group_details group_details_state clearfix" v-for="(item,index) in dataList" :key="item.id">
				<div class="fl head_card">
					<img :src="item.Picurl" alt="" class="spinning_img">
				</div>
				<div class="spinning_txt fl content_right">
					<p class="margin_bottom" style="display: flex;align-items: center;">
						<span style="font-size: 0.14rem;">{{item.Username}}</span>
						<img v-if="item.Sex==1" src="images/man.png" style="width: 0.14rem;height: 0.14rem;margin-left: 0.1rem;">
						<img v-if="item.Sex==0" src="images/women.png" style="width: 0.14rem;height: 0.14rem;margin-left: 0.1rem;">
					</p>
					<p style="margin-bottom: 0.1rem;">
						<span class="spinning_name">{{item.Phone}}</span>
					</p>
					<div class="dyy" @click="info(index,item.Uid)">代预约</div>
				</div>
			</div>
			<van-list
				v-model="loading"
				:finished="finished"
				finished-text="没有更多了"
				@load="getList"
				>
				<van-cell
					v-for="item in lists"
					:key="item"
					:title="item"
				/>
				</van-list>
		</template>
	</div>
</body>
<script>
	var app = new Vue({
		el: '#app',
		data: {
			dataList:[], //会员列表数据
			from:{
				phone:'',
				page:'1'
			},
			lists:[],
			loading: false,
			finished: false,
			totalnum:'',
			totalpage:'',
			listd:[],
		},
		methods: {
			getList(){
				const params=this.from
				axios.get('mobileapi/boss/curr.php?act=user_list',{params:params}).then(res => {
					let { msg, code} = res.data
						if (code !== 200) {
							vant.Toast('请求发送失败，请重试')
						} else {
							data=res.data
							this.listd=data.data.list
							this.totalnum=data.data.totalnum
							this.from.page=parseInt(data.data.page)+1
							for(let i in this.listd){
								if(this.listd[i].Picurl==""||this.listd[i].Picurl==null){
									this.listd[i].Picurl='images/moren.png'
								}
							}
							for (let i = 0; i < this.listd.length; i++) {
								this.dataList.push(this.listd[i])
							}
							// 加载状态结束
							this.loading = false
							// 数据全部加载完成
							if (this.dataList.length >= this.totalnum) {
								this.finished = true
							}
						}
				}).catch(err => {
					vant.Toast('请求发送失败，请重试')
				})
			},
			info(index,uid){
				window.location.href=`curriculum_t_yue.html?uid=${uid}`
			},
			search(){
				this.listd=[]
				this.dataList=[]
				this.from.page='1'
				this.getList()
			}
		}
	})
</script>

</html>